Skip to content

feat(core): v0.2 failure detection rules — 7 new rules - #70

Merged
sepehr-safari merged 1 commit into
mainfrom
feat/core-detection-v2
Jul 8, 2026
Merged

feat(core): v0.2 failure detection rules — 7 new rules#70
sepehr-safari merged 1 commit into
mainfrom
feat/core-detection-v2

Conversation

@sepehr-safari

Copy link
Copy Markdown
Member

Summary

Expands failure detection from 3 rules to 10 by adding 7 new detection rules.

New Rules

Rule Description Severity
TIMEOUT_NO_HEARTBEAT No Heartbeat within 2x expected interval after BootNotification warning
METER_VALUE_GAP No MeterValues during a completed transaction warning
INVALID_STOP_REASON StopTransaction with non-standard OCPP 1.6 reason info
UNEXPECTED_START StartTransaction without preceding BootNotification or Authorize warning
STATUS_TRANSITION_VIOLATION Illegal connector status transition per OCPP 1.6 state model warning
DIAGNOSTICS_FAILURE DiagnosticsStatusNotification with UploadFailed or DiagnosisFailed critical
FIRMWARE_UPDATE_FAILURE FirmwareStatusNotification with DownloadFailed, InstallFailed, etc. warning

Changes

  • packages/toolkit/src/core/types.ts — FailureCode type updated with 7 new codes
  • packages/toolkit/src/core/detection.ts — 7 new detection functions + suggested steps + severity
  • packages/toolkit/src/core/detection.test.ts — 18 new tests (2-3 per rule)
  • Fixture updates: added Heartbeat messages to normal-session, connector-fault, station-offline, unexpected-stop-reason to prevent TIMEOUT_NO_HEARTBEAT false positives
  • Fix connector-fault stop reason from 'Faulted' (invalid) to 'Other' (valid)

Verification

  • pnpm test — 214/214 tests pass (196 original + 18 new)
  • pnpm build — clean
  • pnpm lint — clean
  • pnpm typecheck — clean
  • pnpm format:check — clean

Closes #59

Add 7 new failure detection rules to packages/toolkit/src/core/detection.ts:
- TIMEOUT_NO_HEARTBEAT: no Heartbeat within 2x expected interval after BootNotification
- METER_VALUE_GAP: no MeterValues during a completed transaction
- INVALID_STOP_REASON: StopTransaction with non-standard reason code
- UNEXPECTED_START: StartTransaction without preceding BootNotification or Authorize
- STATUS_TRANSITION_VIOLATION: illegal connector status transition per OCPP 1.6
- DIAGNOSTICS_FAILURE: DiagnosticsStatusNotification with failure status
- FIRMWARE_UPDATE_FAILURE: FirmwareStatusNotification with failure status

Update FailureCode type with 7 new codes. Add suggested steps and
severity for each. Add 18 unit tests (2-3 per rule).

Fix existing fixtures: add Heartbeat messages to normal-session,
connector-fault, station-offline, and unexpected-stop-reason fixtures
so new TIMEOUT_NO_HEARTBEAT rule does not false-positive. Fix
connector-fault stop reason from 'Faulted' (invalid) to 'Other'.

Closes #59
@vercel

vercel Bot commented Jul 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ocpp-debugkit-web Ready Ready Preview, Comment Jul 8, 2026 4:58pm

@sepehr-safari
sepehr-safari merged commit 3f9569f into main Jul 8, 2026
4 checks passed
@sepehr-safari
sepehr-safari deleted the feat/core-detection-v2 branch July 8, 2026 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(core): v0.2 failure detection rules — 7 new rules

1 participant